

anim_id=[1 2 3 7 8 9]; % gfpm animals
%anim_id=[4 5 6]; % animals > 150d at imaging
%anim_id=[7 8]; % bone removal
%anim_id=[];

les=[];
con=[];
con_type=[];
les_type=[];

cnt=0;
for ind=1:31
    if length(e_mat{ind,3})>0
        cnt=cnt+1;
        for knd=1:6
            les(knd,cnt)=mean(e_mat{ind,knd})/mean([e_mat{ind,1} e_mat{ind,2}]);
        end
        if sum(hom_data(ind).animal_ID==anim_id)
            les_type(cnt)=1;
        else
            les_type(cnt)=0;
        end
    end
end

cnt=0;
for ind=1:31
    if length(c_mat{ind,3})>0
        cnt=cnt+1;
        for knd=1:6
            con(knd,cnt)=mean(c_mat{ind,knd})/mean([c_mat{ind,1} c_mat{ind,2}]);
        end
        if sum(hom_data(ind).animal_ID==anim_id)
            con_type(cnt)=1;
        else
            con_type(cnt)=0;
        end
    end
end

les_type=logical(les_type);
con_type=logical(con_type);

timepoints=[-48 -24 6 18 24 48];

figure;
subplot(121)
hold on
if sum(les_type)
    plot(timepoints(1:2),les(1:2,les_type),'--k','linewidth',2)
    plot(timepoints(3:6),les(3:6,les_type),'--k','linewidth',2)
end
if sum(~les_type)
    plot(timepoints(1:2),les(1:2,~les_type),'k','linewidth',2)
    plot(timepoints(3:6),les(3:6,~les_type),'k','linewidth',2)
end
ylim([0 2.5])

subplot(122)
hold on
if sum(con_type)
    plot(timepoints(1:2),con(1:2,con_type),'--r','linewidth',2)
    plot(timepoints(3:6),con(3:6,con_type),'--r','linewidth',2)
end
if sum(~con_type)
    plot(timepoints(1:2),con(1:2,~con_type),'r','linewidth',2)
    plot(timepoints(3:6),con(3:6,~con_type),'r','linewidth',2)
end
ylim([0 2.5])
